/*
 * @Author: fhw
 * @Date: 2022-07-27 10:21:06
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-28 14:00:05
 * @Description:
 */
import { ApiProperty } from '@nestjs/swagger'
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
import { PaginatedResult } from '../../common/entities/entities'

@Entity('article_category')
export class Category {
  @ApiProperty({ example: 'id', description: 'id' })
  @PrimaryGeneratedColumn()
  id: number

  @ApiProperty({ example: 'name', description: '名称' })
  @Column({
    type: 'varchar',
    length: 255,
  })
  name: string
  
  @ApiProperty({ example: 'date', description: '创建时间' })
  @CreateDateColumn({
    type: 'datetime',
    comment: '创建时间',
  })
  createDate: string;

  @ApiProperty({ example: 'updateDate', description: '更新时间' })
  @UpdateDateColumn({
    type: 'datetime',
    comment: '更新时间',
  })
  updateDate: string;
}
export class CategoryResult extends PaginatedResult {
  @ApiProperty({
    example: Category,
    type: [Category],
  })
  data: Category[]
  @ApiProperty({ example: 'pageSize', description: '数量' })
  pageSize: number
  @ApiProperty({ example: 'pageNum', description: '页数' })
  pageNum: number
  @ApiProperty({ example: 'total', description: '总数' })
  total: number
}
